﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DCSLibrary;
using Telerik.Web.UI;

public partial class Admin_Module_danh_sach_nguoi_dung : System.Web.UI.UserControl
{
    #region Cac bien dung chung
    UsersUI objUsers = new UsersUI();
    DataSet dsUsers;

    #endregion

    #region Cac Ham Su Kien

    protected void Page_Load(object sender, EventArgs e)
    {
        dsUsers = objUsers.GetAll();
        if (!IsPostBack)
        {
            BindGrid();
        }
    }

    protected void Ajax_Request(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
        }
    }

    #endregion

    #region Cac Ham Tuong Tac Du Lieu

    private void BindGrid()
    {
        grd.DataSource = dsUsers.Tables[0];
        grd.DataBind();
    }

    #endregion

    #region Cac ham khac

    protected string GetUserType(byte userType)
    {
        if (userType == Convert.ToByte(Utils.Common.USER_TYPE.NotSet))
        {
            return "Chưa xác định";
        }
        else if (userType == Convert.ToByte(Utils.Common.USER_TYPE.User))
        {
            return "Người dùng";
        }
        else if (userType == Convert.ToByte(Utils.Common.USER_TYPE.Admin))
        {
            return "Quản Trị";
        }
        return "";
    }

    #endregion

    protected void grd_PageIndexChanged(object source, GridPageChangedEventArgs e)
    {
        BindGrid();
    }
}
